<?php
/**
 * Created by litong on Date: 2019/2/24 0024 下午 8:24
 */
$host = "localhost";
$username = "root";
$password = "";
$dbname="php_study";
$connection = new mysqli($host, $username, $password,$dbname);
if ($connection->connect_error) {
  echo "连接数据库失败:" . $connection->connect_error. PHP_EOL;
}
$sql = "CREATE TABLE my_guests(id INT(6) AUTO_INCREMENT PRIMARY KEY,firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,email VARCHAR(50),reg_date TIMESTAMP);";

if($connection->query($sql)){
  echo "创建成功:".$sql.PHP_EOL;
}else{
  echo "创建失败:".$sql.$connection->error.PHP_EOL;
}
